Dynomotion

Group: DynoMotion Message: 11027 From: janbbeck Date: 2/5/2015
Subject: Linear motor

Hi, I have a KFLOP/SNAPAMP and am driving a linear motor with it. The motor is a Parker Trilogy and it has a Renishaw RGH24 1um/div linear encoder attached. 


The following things work:

- The encoder gives the correct count.

- The current limit is set and enforced at 2A.

- When enabled, the motor is held in place with quite a bit of force. The current is proportional to the amount of force I push the motor with.

- When the motor is not pushed, no current flows.


So far, so good. Here is what I need some help with:


The hall sensors are not connected, I am not sure if they are needed.


So the problem that I see is that if I push the motor past a certain amount, it snaps to the next pole position and is held there forcefully. The current goes to the current limit. The expected behavior would be that it travels back to the initial position, of course. I suspect that the hall sensors are necessary to get that to work, but really don't understand what I am seeing.


I can't use the autophasefind, because the linear encoder has no index pulse. Ideally I would like to home with a hard stop, but really, if it sets the position to zero on power on, that would be a good start.


I would appreciate any help.


Group: DynoMotion Message: 11031 From: Tom Kerekes Date: 2/5/2015
Subject: Re: Linear motor
Hi Jan,

As you probably know Brushless motors (linear or rotary) need to be properly commutated to be able to generate torque properly.  This involves distributing the current to the correct coils in the proper distribution to generate optimal torque.  Hall Sensors or Encoder position can be used to do this.  Encoder position is the preferred method because it is more exact and allows true sinusoidal commutation.  Hall Sensors are less optimal and create more torque ripple but have the advantage of being absolute, whereas encoder commutation is incremental and needs to be somehow related to rotor position after a power cycle.  To do Encoder Commutation properly two things are required:  The Distance per Commutation Cycle (this is the fixed pole to pole distance of the motor) and the Commutation Offset which is necessary to relate the encoder position to the the rotor position.  

On power up the encoder position is not likely to be aligned to the rotor position so some method must be used to set the relationship.  There are 3 typical methods:

#1 reference/index mark - This is the preferred approach where the phases are energized and cycled to rotate the rotor until the index mark is detected.  At that point the exact commutation angle is known regardless of any motor load or friction.

#2 coil energized - This method applies current to the coils in a particular manner which should cause the rotor to snap to a particular orientation.  Ideally the motor will move to the position where zero torque is created by the motor current.  When the rotor is remaining still we know the torque must be zero otherwise the rotor would accelerate.  At this point it is known where the rotor is located and that the position of maximum torque would be 1/4 commutation cycle away.   However if there is some other mechanical force being applied to the rotor (friction, gravity, hardstop) then the torque created by the motor current will not be exactly zero.   So this technique may not work well if unknown loads are present on power up.

#3 excitation - This method injects a stimulus into each coil to measure the response (beyond the scope of this discussion)

Here are some ideas for your situation:

#1 You might use a Hall sensor in a similar method as an index pulse.  However a Hall Sensor outputs a signal level over a large distance unlike an index pulse.  But you might use one edge transition of one Hall Sensor as the equivalent of an Index Pulse.  I'm not sure how accurate that may be.  I'd suggest modifying the AutoPhaseFind.c program to look for a particular edge transition of one hall sensor.

 
#2 You could use the hard stop by cycling the phases to cause motion until motion stops and assume that a hard stop is encountered.  You could then zero the encoder and use a commutation offset previously found by trial-and-error or other means.

Let me know how much of this makes sense.

HTH
Regards
TK


Group: DynoMotion Message: 11033 From: janbbeck Date: 2/5/2015
Subject: Re: Linear motor
Thanks! That all makes good sense, and I know what to do now. It raises a further question:

Since you brought up the accuracy of the Hall sensors, how accurate does the commutation offset and distance per commutation cycle have to be known? Or equivalently, what is the effect of physical jitter in these values? I am asking because this linear motor is going to have some variation of these values along its length.  I suspect this would just manifest itself as higher torque ripple, but would like to understand what is going on better.


---In DynoMotion@yahoogroups.com, <tk@...> wrote :

Hi Jan,

As you probably know Brushless motors (linear or rotary) need to be properly commutated to be able to generate torque properly.  This involves distributing the current to the correct coils in the proper distribution to generate optimal torque.  Hall Sensors or Encoder position can be used to do this.  Encoder position is the preferred method because it is more exact and allows true sinusoidal commutation.  Hall Sensors are less optimal and create more torque ripple but have the advantage of being absolute, whereas encoder commutation is incremental and needs to be somehow related to rotor position after a power cycle.  To do Encoder Commutation properly two things are required:  The Distance per Commutation Cycle (this is the fixed pole to pole distance of the motor) and the Commutation Offset which is necessary to relate the encoder position to the the rotor position.  

On power up the encoder position is not likely to be aligned to the rotor position so some method must be used to set the relationship.  There are 3 typical methods:

#1 reference/index mark - This is the preferred approach where the phases are energized and cycled to rotate the rotor until the index mark is detected.  At that point the exact commutation angle is known regardless of any motor load or friction.

#2 coil energized - This method applies current to the coils in a particular manner which should cause the rotor to snap to a particular orientation.  Ideally the motor will move to the position where zero torque is created by the motor current.  When the rotor is remaining still we know the torque must be zero otherwise the rotor would accelerate.  At this point it is known where the rotor is located and that the position of maximum torque would be 1/4 commutation cycle away.   However if there is some other mechanical force being applied to the rotor (friction, gravity, hardstop) then the torque created by the motor current will not be exactly zero.   So this technique may not work well if unknown loads are present on power up.

#3 excitation - This method injects a stimulus into each coil to measure the response (beyond the scope of this discussion)

Here are some ideas for your situation:

#1 You might use a Hall sensor in a similar method as an index pulse.  However a Hall Sensor outputs a signal level over a large distance unlike an index pulse.  But you might use one edge transition of one Hall Sensor as the equivalent of an Index Pulse.  I'm not sure how accurate that may be.  I'd suggest modifying the AutoPhaseFind.c program to look for a particular edge transition of one hall sensor.

 
#2 You could use the hard stop by cycling the phases to cause motion until motion stops and assume that a hard stop is encountered.  You could then zero the encoder and use a commutation offset previously found by trial-and-error or other means.

Let me know how much of this makes sense.

HTH
Regards
TK


Group: DynoMotion Message: 11042 From: janbbeck Date: 2/7/2015
Subject: Re: Linear motor
Ok, I played with this a bit more, and I am having some problems. My goal at this point is just to get the motor holding a position and returning to it if forced away.

My approach is to 
- use Write3PH to energize the coil to snap the motor to the closest zero phase position
- manually enter the invDistPerCycle 
- zero the encoder and position
- enter commutation offset of 1/4 cycle, as indicated by the autophasefind.c

This does not work for me. The motor holds fast to certain positions, but once I push it far enough, it snaps to the next position.

I would appreciate any input.

#define PWM_CHAN 8   // which pair of PWM channels used
#define ENCODER_CHAN 0  // which encoder we are connected to
#define ENCODER_GAIN 1   // Set to -1 if desired to reverse axis direction
#define AMPLITUDE 100     // Set how hard to drive the coils pwm counts
#define AXIS_CHAN 0        // Axis channel to be used and configured

main()
{
WriteSnapAmp(SNAP0+SNAP_PEAK_CUR_LIMIT0,9); // current limit
WriteSnapAmp(SNAP0+SNAP_PEAK_CUR_LIMIT1,9); // current limit
CHAN *ch = &chan[AXIS_CHAN];
ch->Enable=FALSE; // turn feedback back on
ch->OutputChan0=PWM_CHAN;
ch->InputMode=ENCODER_MODE;
ch->InputChan0=ENCODER_CHAN;
ch->OutputMode=BRUSHLESS_3PH_MODE;
ch->InputGain0=ENCODER_GAIN;
ch->invDistPerCycle = 1.0/60960; // 60.96 mm per electrical cycle according to documentation; 1um encoder
Write3PH(ch,AMPLITUDE,0.0 );  // move the pole to zero position
Delay_sec(1.00);  // wait a second 
Write3PH(ch0,0,0); // turn off the coil 
ch->Position=0;   // set current position to Zero
ch->Dest=0;   // set current position to Zero
ch->CommutationOffset = 60960/4; // offsetting by 1/4 of a cycle 
//ch->Enable=TRUE; // turn feedback back on
}

Group: DynoMotion Message: 11044 From: Tom Kerekes Date: 2/8/2015
Subject: Re: Linear motor
Hi Jan,

It sounds like commutation is not working properly.

What does the report of AutoPhaseFind.c indicate?   Did you wire in a Hall Sensor?

You might try reversing the sign of the CommutationOffset and/or the invDistPerCycle.

Did you verify that the encoder is actually 1um/count?  (push axis 100mm verify it changes by 100,000?)
If you simply disable the axis and energize the coils with:

Write3PH(ch,AMPLITUDE,0.0 );  // move the pole to zero position

Then force it to the next motor pole.  Is it ~ 60960 counts way?

Regards
TK





Group: DynoMotion Message: 11048 From: janbbeck Date: 2/8/2015
Subject: Re: Linear motor
Thanks for the reply!


> What does the report of AutoPhaseFind.c indicate?   Did you wire in a Hall Sensor?

I did. Autophasefind oscillates the motor back and forth a few mm. If the oscillation is not close to a hall transition it goes on forever. If it is, I get something like this:
REPORT
------
0 Position =      0 PhaseAngle = 7.034000
1 Position =      0 PhaseAngle = 8.027000
2 Position =      0 PhaseAngle = 7.356000
3 Position =      0 PhaseAngle = 6.343000
Counts per rev =      0
Counts per cycle =      0
Counts per cycle (rounded)=      0
invDistPerCycle (rounded)= 17976931348623459339141845703125000000000000000000000000000000000000000000000000000000000000000000
000Commutation offset =      0
Input Gain Specified = -1.000



> You might try reversing the sign of the CommutationOffset and/or the invDistPerCycle.

Changing the sign of the offset has no noticeable effect.
Changing the sign of the invDistPerCycle causes the motor to spectacularly run off in one direction. 

Incidentally, this pulled the connection wires out of the motor and made me have to reconnect them. And now everything works as it should...wow. Any ideas what was wrong??

Thanks for the help! On to my next adventure -> tuning the loop :)



Group: DynoMotion Message: 11053 From: Tom Kerekes Date: 2/9/2015
Subject: Re: Linear motor
Hi Jan,

Yikes.  You might have had positive feedback instead of negative feedback.  By limiting the Max Output and also setting a Max Following Error you can have things quickly disable when things are wrong to help avoid damage.

If the motor drives all the way along the length that would indicate the commutation is at least working reasonably well.

Regards
TK


From: "homeloan@... [DynoMotion]" <DynoMotion@yahoogroups.com>
To: DynoMotion@yahoogroups.com
Sent: Sunday, February 8, 2015 4:18 PM
Subject: Re: [DynoMotion] Linear motor

 
Thanks for the reply!


> What does the report of AutoPhaseFind.c indicate?   Did you wire in a Hall Sensor?

I did. Autophasefind oscillates the motor back and forth a few mm. If the oscillation is not close to a hall transition it goes on forever. If it is, I get something like this:
REPORT
------
0 Position =      0 PhaseAngle = 7.034000
1 Position =      0 PhaseAngle = 8.027000
2 Position =      0 PhaseAngle = 7.356000
3 Position =      0 PhaseAngle = 6.343000
Counts per rev =      0
Counts per cycle =      0
Counts per cycle (rounded)=      0
invDistPerCycle (rounded)= 17976931348623459339141845703125000000000000000000000000000000000000000000000000000000000000000000
000Commutation offset =      0
Input Gain Specified = -1.000



> You might try reversing the sign of the CommutationOffset and/or the invDistPerCycle.

Changing the sign of the offset has no noticeable effect.
Changing the sign of the invDistPerCycle causes the motor to spectacularly run off in one direction. 

Incidentally, this pulled the connection wires out of the motor and made me have to reconnect them. And now everything works as it should...wow. Any ideas what was wrong??

Thanks for the help! On to my next adventure -> tuning the loop :)



Group: DynoMotion Message: 11055 From: janbbeck Date: 2/9/2015
Subject: Re: Linear motor
Well, at least it is working now. This is fun to play with. I have another motor that I want to try out, a PMI ServoDisc. I have read of the granite devices drives needing a series inductance because of the low inductance of the motor. I don't understand why that would be (inrush current??). But more importantly, am I going to have a problem with SnapAmp? The inductance is <100 uH...
Group: DynoMotion Message: 11056 From: Tom Kerekes Date: 2/10/2015
Subject: Re: Linear motor
Hi Jan,

Yes that would be too low of inductance.  The basic idea of a switching regulator is that the coil current should change much within one PWM period.  SnapAmp uses a 30KHz PWM frequency.  With a supply voltage of 80V the p-p current ripple would be:

80V * 15us / 100uH = 12A !!

Is this a 3 phase motor?

Regards
TK

Group: DynoMotion Message: 11057 From: janbbeck Date: 2/10/2015
Subject: Re: Linear motor
No, it is a brush DC motor. Does that make any difference?